#include<stdio.h>
#include<string.h>
int main(int argc, char const *argv[])
{
    int n=0;
    char filename[100];
    char buf[100];

    bzero(filename,100);
    bzero(buf,100);
    printf("please input file1:");
    fscanf(stdin,"%s",filename);
    FILE *fp = fopen(filename,"r");
    if(fp==NULL)
    {
        perror("fopen file1 fail");
        return -1;
    }
    while(1)
    {
        if(fgets(buf,100,fp)==NULL)
        {
            break;
        }
        printf("%s",buf);
    }

    bzero(filename,100);
    bzero(buf,100);
    printf("please input file2:");
    fscanf(stdin,"%s",filename);
    FILE *fp2 = fopen(filename,"r");
    if(fp2==NULL)
    {
        perror("fopen file2 fail");
        return -1;
    }
    while(1)
    {
        if(fgets(buf,100,fp2)==NULL)
        {
            break;
        }
        printf("%s",buf);
    }

    bzero(filename,100);
    bzero(buf,100);
    printf("please input file3:");
    fscanf(stdin,"%s",filename);
    FILE *fp3 = fopen(filename,"r");
    if(fp3==NULL)
    {
        perror("fopen file3 fail");
        return -1;
    }
    while(1)
    {
        if(fgets(buf,100,fp3)==NULL)
        {
            break;
        }
        printf("%s",buf);
    }
    printf("------------\n");
    int a;
    if((a=fcloseall())==EOF)
    {
        perror("close fail");
        return -1;
    }else
    {
        printf("%d",a);
        printf("Allfile successfully closed");
    }

    return 0;
}
